package com.jiaai.cloud.picture.controller;

import com.jiaai.cloud.base.exception.ServiceException;
import com.jiaai.cloud.picture.entity.TPicture;
import com.jiaai.cloud.picture.service.ITPictureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 佳爱网络科技
 * @since 2017-08-25
 */
@RestController
@RequestMapping("/api/manage/tPicture")
public class TPictureController {
	@Autowired
    private ITPictureService itPictureService;


    //可以添加，有的话可以修改
    @RequestMapping( value ="/edit" ,method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"})
    public  Object edit(@RequestBody TPicture tPicture) throws ServiceException {
        try {
            tPicture.setCreatTime(new Date());
            tPicture.setImg("http://588ku.com/sucai/8439770.html");
            itPictureService.insertOrUpdate(tPicture);
            return null;
        } catch (Exception e) {
            throw new ServiceException("更改失敗", e.getMessage());
        }
    }





}
